DROP VIEW [dbo].[vi0148]
GO
CREATE VIEW [dbo].[vi0148] AS 
Select 	tb0109.VoucherID, 
	tb0109.VoucherDate,
	tb0109.VoucherNo,
	tb0110.TransactionID,
	tb0110.InventoryID
From tb0110 inner join tb0109 on tb0109.VoucherID = tb0110.VoucherID
	    inner join tb0054 on tb0054.InventoryID = tb0110.InventoryID
Where (tb0054.IsSource=1 or tb0054.IsLimitDate=1 or tb0054.MethodID =3)
Union ALL
Select 	tb0104.VoucherID, 
	tb0104.VoucherDate,
	tb0104.VoucherNo,
	tb0105.TransactionID,
	tb0105.InventoryID
From tb0105 inner join tb0104 on tb0104.VoucherID = tb0105.VoucherID
	    inner join tb0054 on tb0054.InventoryID = tb0105.InventoryID
Where (tb0054.IsSource=1 or tb0054.IsLimitDate=1 or tb0054.MethodID =3) And KindVoucherID in ( 1,3,5,7,9)

GO